public abstract class Shape {
    public abstract void draw(Graphics g);
}

public class Point {
    public int x;
    public int y;
}

public class Line extends Shape {
    public Point start;
    public Point end;

    public Line(Point start, Point end) {
        this.start = start;
        this.end = end;
    }

    @Override
    public void draw(Graphics g) {
        g.drawLine(start.x, start.y, end.x, end.y);
    }
}

public class Rect extends Shape {
    public Point leftUp;
    public int width;
    public int height;

    public Rect(Point leftUp, int width, int height) {
        this.leftUp = leftUp;
        this.width = width;
        this.height = height;
    }

    @Override
    public void draw(Graphics g) {
        g.drawRect(leftUp.x, leftUp.y, width, height);
    }
}

//增加
public class Circle extends Shape {
    //实现自己的Draw，负责画自己
    @Override
    public void draw(Graphics g) {
       g.drawOval(...);
   }
}
